package org.surthi.app.bank.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.servlet.mvc.multiaction.MethodNameResolver;
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;

public class SimpleMethodNameResolver implements MethodNameResolver {

	String defaultMethod;
	
	public SimpleMethodNameResolver(String defaultMethodName){
		defaultMethod = defaultMethodName;
	}
	public String getHandlerMethodName(HttpServletRequest request)
			throws NoSuchRequestHandlingMethodException {
		String methodName = request.getParameter("action");
		if (methodName == null ){
			methodName = defaultMethod;
		}
		return methodName;
	}
}
